I = imread('Lenna.jpg');
J = imnoise(I, 'salt & pepper', 0.05);
h = fspecial('average', [3 3]);
K1 = J;
for i = 1:10
    K1 = imfilter(K1, h);
end
K2 = J;
for i = 1:20
    K2 = imfilter(K2, h);
end
figure;
subplot(2,2,1);
imshow(J);
title('Noisy Image');
subplot(2,2,2);
imshow(K1);
title('10');
subplot(2,2,3);
imshow(K2);
title('20');